package com.auto.sns.core.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.auto.sns.core.util.CoreUtil;
import com.system.common.BaseAction;

/**
 * 首页显示action
 * @author wsh
 *
 */
public class SnsCoreShowMainAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1273823348957666860L;

	public String showMainUserInfo() throws Exception{
		//个人资料
		Map<String, String> userInfoMap = new HashMap<String, String> ();
		userInfoMap.put("userName", "路飞");
		userInfoMap.put("orgName", "海贼王");
		userInfoMap.put("deptName", "草帽军团");
		userInfoMap.put("jobName", "海贼");
		userInfoMap.put("specializeTypeName", "橡皮人打架");
		userInfoMap.put("specializeProjectName", "打架");
		
		//全部类型
		List allList = new ArrayList();
		
		Map<String, Object> allMap_1 = new HashMap<String, Object> ();
		allMap_1.put("type", "activity");
		allMap_1.put("activitypersonlogo", "213243574345");
		allMap_1.put("activityname", "奥斯特洛夫斯基");
		allMap_1.put("activitycontent", "上海车牌破九万了呀，我的奥拓怎么办");
		allMap_1.put("activitytime", "2013.1.1 10:11:12");
		allMap_1.put("activitytimelong", "1小时");
		allMap_1.put("activityaddr", "世纪大道");
		allMap_1.put("time", "2012.10.10 10:10:10");
		allMap_1.put("returncount", "10");
		allMap_1.put("commendcount", "14");
		allMap_1.put("collectioncount", "20");
		allMap_1.put("isauthor", "1");
		
		List allReturnList = new ArrayList();
		Map<String, String> allMap_1_return = new HashMap<String, String> ();
		allMap_1_return.put("returnpersonlogo", "31523462522452");
		allMap_1_return.put("returnname", "坑得斯基");
		allMap_1_return.put("returncontent", "不买车，没压力");
		allMap_1_return.put("returntime", "2013.1.1 10:11:13");
		allReturnList.add(allMap_1_return);
		allMap_1.put("allReturnList", allReturnList);
		allList.add(allMap_1);
		
		Map<String, Object> allMap_2 = new HashMap<String, Object> ();
		allMap_2.put("type", "vote");
		allMap_2.put("votepersonlogo", "213243574345");
		allMap_2.put("votename", "萝卜丝");
		allMap_2.put("votecontent", "程序猿就是什么类型的人？");
		allMap_2.put("votecount", "1331");
		
		allMap_2.put("time", "2012.10.10 10:10:10");
		allMap_2.put("returncount", "10");
		allMap_2.put("commendcount", "14");
		allMap_2.put("collectioncount", "20");
		allList.add(allMap_2);
		
		//任务类型
		Map<String, String>  roleMap = new HashMap<String, String> ();
		
		//活动类型
		Map<String, String>  activityMap = new HashMap<String, String> ();
		
		//投票类型
		Map<String, String>  voteMap = new HashMap<String, String> ();
		
		//话题类型
		Map<String, String>  themeMap = new HashMap<String, String> ();
		
		//今日任务
		List todayRoleList = CoreUtil.getTodayRoleListInfo();

		//热门话题
		List popTopicList = CoreUtil.getPopTopicListInfo();
		
		//关注话题
		List attentionTopicList = CoreUtil.getAttentionTopicListInfo();
		
		//任务个数
		String roleCount = CoreUtil.getRoleCount();
		
		//消息个数
		String messageCount = CoreUtil.getNewsCount();
		
		this.getRequest().setAttribute("roleCount", roleCount);
		this.getRequest().setAttribute("messageCount", messageCount);
		
		this.getRequest().setAttribute("todayRoleList", todayRoleList);
		this.getRequest().setAttribute("popTopicList", popTopicList);
		this.getRequest().setAttribute("attentionTopicList", attentionTopicList);
		
		this.getRequest().setAttribute("userInfoMap", userInfoMap);
		this.getRequest().setAttribute("allList", allList);
		this.getRequest().setAttribute("roleMap", roleMap);
		this.getRequest().setAttribute("activityMap", activityMap);
		this.getRequest().setAttribute("voteMap", voteMap);
		this.getRequest().setAttribute("themeMap", themeMap);
		return "success";
	}
	
	/**
	 * 查看更多信息
	 */
	public void lookAddedInfo(){
		
	}
	
	public String companyTrends(){
		//今日任务
		List todayRoleList = CoreUtil.getTodayRoleListInfo();

		//热门话题
		List popTopicList = CoreUtil.getPopTopicListInfo();
		
		//关注话题
		List attentionTopicList = CoreUtil.getAttentionTopicListInfo();
		
		//任务个数
		String roleCount = CoreUtil.getRoleCount();
		
		//消息个数
		String messageCount = CoreUtil.getNewsCount();
		
		this.getRequest().setAttribute("roleCount", roleCount);
		this.getRequest().setAttribute("messageCount", messageCount);
		
		this.getRequest().setAttribute("todayRoleList", todayRoleList);
		this.getRequest().setAttribute("popTopicList", popTopicList);
		this.getRequest().setAttribute("attentionTopicList", attentionTopicList);
		return "success";
	}
	
}
